﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using KZ.Express.H.ENT;
using KZ.Express.H.Presenter;
using KZ.Utilities;

namespace KZ.Express.H.Settings.Customers
{
    public partial class CustomerListView : BaseView
    {
        #region Fields

        #endregion

        #region Private Methods

        private void CustomerListView_Load(object sender, EventArgs e)
        {
        }

        #endregion Private Methods

        #region Constructors

        public CustomerListView()
        {
            InitializeComponent();
            Initialize(dtgCustomer);

            _presenter = new BasePresenter(this);

            this.ObjectID = (int)Objects.Customer;
            this.ActionName = "List";
            this.VisibleChanged += new EventHandler(View_VisibleChanged<CustomerENT>);
            this.dtgCustomer.Sorted += new EventHandler(Datagrid_Sorted);


            this.OnDeleteClick += new DeleteClickHandler(View_OnDeleteClick<CustomerENT>);
            this.btnSearch.Click += new EventHandler(View_OnSearchClick<CustomerENT>);
            this.btnViewAll.Click += new EventHandler(View_OnViewAllClick<CustomerENT>);
        }

        #endregion Constructors

        #region Public Properties
        [Search]
        public string CustomerCode
        {
            get { return txtCustomerCode.Text; }
            set { txtCustomerCode.Text = value; }
        }

        [Search]
        public string CustomerName
        {
            get { return txtCustomerName.Text; }
            set { txtCustomerName.Text = value; }
        }

        [Search]
        public string SaleName
        {
            get { return txtSaleName.Text; }
            set { txtSaleName.Text = value; }
        }

        [Search]
        public int SaleID
        {
            get
            {
                if (UserENT._ROLEID == 2)
                    return UserENT._USERID;
                return 0;
            }
        }

        #endregion
    }
}
